﻿#include "addruleform.h"
#include "ui_addruleform.h"

addRuleForm::addRuleForm(QDialog *parent) :
    QDialog(parent),
    ui(new Ui::addRuleForm)
{
    ui->setupUi(this);
}

addRuleForm::~addRuleForm()
{
    delete ui;
}

Rule_t addRuleForm::getRule(bool *ok)
{
    *ok = ok_;

    return rule_;
}

void addRuleForm::on_pb_add_clicked()
{
    ok_ = true;

    rule_.start_pos = ui->le_field_start->text().toUInt();
    rule_.end_pos = ui->le_field_end->text().toUInt();
    rule_.field_name = ui->le_field_name->text();
    rule_.field_type = ui->cb_data_type->currentText();
    this->close();
}

void addRuleForm::on_pb_cancel_clicked()
{
    ok_ = true;
}
